import Vue from 'vue';
import VueRouter from 'vue-router';
import Layout from '../pages/layout/index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/profile',
    children: [
      {
        path: '/profile',
        name: 'profile',
        component: () => import('@/pages/profile/index.vue'),
        meta: {
          title: '首页'
        }
      },
      {
        path: '/product',
        name: 'product',
        component: () => import('@/pages/content/product/index.vue')
      },
      {
        path: '/evaluate',
        name: 'evaluate',
        component: () => import('@/pages/content/evaluate/index.vue')
      }
    ]
  },
  {
    path: '/uploadArticle',
    name: 'uploadArticle',
    component: () => import('@/pages/publish/uploadArticle/index.vue')
  },
  {
    path: '/uploadVideo',
    name: 'uploadVideo',
    component: () => import('@/pages/publish/uploadVideo/index.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/pages/login.vue')
  }
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});

export default router;
